/* * @Author: wangsh  * @Date: 2019-05-11 19:46:23  */
import React, { Component } from 'react';
import ReactDom from 'react-dom';
import { Provider } from 'react-redux';
import { HashRouter, Switch, Route } from 'react-router-dom';

import Login from 'page/login';
import './style/reset.scss';
import Home from 'common/home';
import UiSwiper from 'page/swiper';
import NoaMatch from 'common/NoaMatch';
import Shape from 'page/shape';
import Tables from 'page/tables';
import RichEditor from 'page/RichEditor';
import Echarts from 'page/echarts';
import { EchartsPie, EchartsBar } from 'page/echarts/echarts';
import Admin from './admin';
import store from './store';

class App extends Component {
  render() {
    return (
      <Provider store={store}>
        <HashRouter>
          <Switch>
            <Route exact path="/login" component={Login} />
            <Route
              path="/"
              render={() => (
                <Admin>
                  <Switch>
                    <Route path="/" exact component={Home} />
                    <Route path="/ui/shape" exact component={Shape} />
                    <Route path="/ui/swiper" exact component={UiSwiper} />
                    <Route path="/rich" exact component={RichEditor} />
                    <Route path="/echarts" exact component={Echarts} />
                    <Route path="/table/basic" exact component={Tables} />
                    <Route path="/form/login" exact component={Login} />
                    <Route path="/charts/bar" exact component={EchartsBar} />
                    <Route path="/charts/pie" exact component={EchartsPie} />
                    <Route component={NoaMatch} />
                  </Switch>
                </Admin>
              )
            }
            />
          </Switch>
        </HashRouter>
      </Provider>
    );
  }
}

ReactDom.render(<App />, document.getElementById('app'));
